package org.kmp.project.main.account.detail

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.Button
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import org.kmp.project.INavElement
import org.kmp.project.NavigationManager


class AccountDetail: INavElement{

    private val TAG="AccountDetail"

    override fun tag(): String {
        return TAG
    }

    val viewModel=AccountDetailViewModel()

    fun setParams(userId: String):AccountDetail{
        viewModel.userId=userId
        return this
    }

    @Composable
    override fun screen() {
        Column(
            modifier = Modifier.fillMaxSize(),
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Text("详情页 ID: ${viewModel.userId}")
            Button(onClick = {
                NavigationManager.navigateBack("wahahaha")
            }) {
                Text("返回首页 带参数")
            }

            Button(onClick = {
                NavigationManager.navigateBack()
            }) {
                Text("返回首页 不带")
            }


            Row(
                modifier = Modifier.fillMaxWidth(),
                horizontalArrangement = Arrangement.SpaceBetween,
                verticalAlignment = Alignment.CenterVertically
            ) {
                Text("哦哦哦哦")
                Switch(
                    checked = viewModel.notificationsEnabled,
                    onCheckedChange = { viewModel.notificationsEnabled=it }
                )
            }
        }
    }


}

